import Cell from "./Base/Cell";
import { EventType } from "./Base/EventType";

export default class GameInstance {
    constructor() {

    }
    public static instance: GameInstance = null;

    public nodeList: Cell[] = [];

    public renderLayer: cc.Node = null;

    static getInstance() {

        if (!this.instance) {
            this.instance = new GameInstance();
        }
        return this.instance;
    }
    public setRenderLayer(renderLayer: cc.Node) {
        this.renderLayer = renderLayer;
    }

    public createOneNode() {
        //创建一个节点
        let node = new Cell('update');
        this.nodeList.push(node);
        if (cc.isValid(this.renderLayer)) {
            this.renderLayer.emit(EventType.DrawNode.toString());
        }
    }
   
}